package renderer2;

import org.lwjgl.opengl.GL11;

import world.World;

public class ChunkRenderer {
    public int posX;
    public int posY;
    public int posZ;
    
    public int posXPlus;
    public int posYPlus;
    public int posZPlus;
    
    public int posXClip;
    public int posYClip;
    public int posZClip;
    

    public int posXMinus;
    public int posYMinus;
    public int posZMinus;
    
    private int glRenderList = -1;
    private World world;



	public ChunkRenderer(World world, int posX, int posY, int posZ, int renderList) {
        this.world = world;
        this.glRenderList = renderList;
        this.posX = -999;
        this.setPosition(posX, posY, posZ);
	}
	
    public void setPosition(int par1, int par2, int par3)
    {
        if (par1 != this.posX || par2 != this.posY || par3 != this.posZ)
        {
            //this.setDontDraw();
            this.posX = par1;
            this.posY = par2;
            this.posZ = par3;
            this.posXPlus = par1 + 8;
            this.posYPlus = par2 + 8;
            this.posZPlus = par3 + 8;
            
            this.posXClip = par1 & 1023;//111-1111-1111
            this.posYClip = par2;
            this.posZClip = par3 & 1023;
            
            this.posXMinus = par1 - this.posXClip;
            this.posYMinus = par2 - this.posYClip;
            this.posZMinus = par3 - this.posZClip;
            
            float f = 6.0F;
            GL11.glNewList(this.glRenderList + 2, GL11.GL_COMPILE);
/*            RenderItem.renderAABB(
            		AxisAlignedBB.getAABBPool().getAABB((double)((float)this.posXClip - f), (double)((float)this.posYClip - f),
            				(double)((float)this.posZClip - f), (double)((float)(this.posXClip + 16) + f), 
            				(double)((float)(this.posYClip + 16) + f), (double)((float)(this.posZClip + 16) + f)));
*/            GL11.glEndList();
        }
    }


}
